<%-- 
  - Author: Mohtisham.Salahria
  - Date: 23-May-2011
  - Copyright Notice: TRAKHEES
  - Description: show.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>


<c:choose>
	<c:when
		test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		<script language="Javascript" type="text/javascript"
			src='<c:url value="/resources/js/jqgrid/grid.locale-ar.js"/>'></script>
	</c:when>
	<c:otherwise>
		<script language="Javascript" type="text/javascript"
			src='<c:url value="/resources/js/jqgrid/grid.locale-en.js"/>'></script>
	</c:otherwise>
</c:choose>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.base.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.common.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.formedit.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.inlinedit.js"/>'></script>

<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.custom.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/jquery.fmatter.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.filter.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.jqueryui.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.import.js"/>'></script>
<script language="Javascript" type="text/javascript"
	src='<c:url value="/resources/js/jqgrid/grid.grouping.js"/>'></script>
<script type="text/javascript">
    $.jgrid.no_legacy_api = true;
    $.jgrid.useJSON = true;
</script>
	
<script type="text/javascript"><!--
$().ready(function() {
	jQuery("#grid").jqGrid({
		 datatype :'json',
		 url		 :'${pageContext.request.contextPath}/user/general/home/userRequestList.json', 
		 autowidth: true,
		 height: 'auto', 
		 rowNum: 10, 
		 rowList: [10,20,30],
		 colNames:['<spring:message code="label.user.request.application.date" />','<spring:message code="label.user.request.reference.no" />','<spring:message code="label.process.code" />','<spring:message code="label.user.request.desc" />', '<spring:message code="label.user.request.desc" />','<spring:message code="label.user.request.status" />', '<spring:message code="label.user.request.status" />', '<spring:message code="label.user.request.status" />','<spring:message code="label.application.link" />', '<spring:message code="label.admin.action" />'],
		 colModel:[ 
					 {name:'applicationDate',index:'applicationDate', width:200,sorttype: "date", sortable : true, datefmt:"dd/mm/Y"},
					 {name:'strClientRefNo',index:'strClientRefNo', width:200,sortable : true, search: true},
					 {name:'processCode',index:'processCode', width:0,sortable : true, hidden: true},
					 {name:'strProcessCodeDescAr',index:'strProcessCodeDescAr', width:600,sortable : true								 
					 <c:choose>
						 <c:when test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
					 		},	 
						 </c:when>
						 <c:otherwise>
							,hidden:true},
						 </c:otherwise>
					 </c:choose>
					 {name:'strProcessCodeDescEn',index:'strProcessCodeDescEn', width:600,sortable : true
					<c:choose>
						 <c:when test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
						 	,hidden:true},	 
						 </c:when>
						 <c:otherwise>
						 	},
						 </c:otherwise>
					 </c:choose>										 
					 {name:'status',index:'status', width:0, sortable : true,hidden: true},
					 {name:'strStatusDescAr',index:'strStatusDescAr', width:400, sorttype:"text",sortable : true, search: true
					 <c:choose>
					 <c:when test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
				 		},	 
					 </c:when>
					 <c:otherwise>
						,hidden:true},
					 </c:otherwise>
				 </c:choose>
				  	{name:'strStatusDescEn',index:'strStatusDescEn', width:400, sorttype:"text", sortable : true, search: true
				<c:choose>
					 <c:when test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
					 	,hidden:true},	 
					 </c:when>
					 <c:otherwise>
					 	},
					 </c:otherwise>
				 </c:choose>
				 	 {name:'applicationLink',index:'applicationLink', width:0,hidden: true},								
					 {name:'action',width:200, sortable: false, formatter:function(){
						 var applicationLink = arguments[2][8];
						 if(applicationLink == null || applicationLink == ''){
							 return '<a href="${pageContext.request.contextPath}/user/general/request/view/show.htm?refNo='+arguments[2][1]+'"><spring:message code="label.user.request.view"/></a>';
						 }else{
							 return '<a href="'+arguments[2][8]+'"><spring:message code="label.user.request.view"/></a>';
						 }
					  }} 
					],
		pager: "#pager",
		viewrecords: true,
		sortname: 'applicationDate', 
		sortorder: "desc", 
		caption: '<spring:message code="label.user.request" />'
		<c:if test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
		, direction:'rtl'
		</c:if>	
	});
  });
--></script>	
<%
		if (session.getAttribute(ConstantsAdmin.SUCCESS_PARAM) != null) {
	%>
<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'success','<%=session.getAttribute(ConstantsAdmin.SUCCESS_PARAM)%>',
											'<spring:message code="msg.success" />');
								});
			</script>
<%
	session.removeAttribute(ConstantsAdmin.SUCCESS_PARAM);
	}
%>
		
<div id="container" dir='<spring:message code="page.dir"/>'  align='<spring:message code="page.align"/>'>
<div id="search"></div>
<table id="grid" width="100%">
</table>
<span id="pager"></span>
</div>
